/*
 * Copyright 2008-2023 dexian.vip. All rights reserved.
 * Support: http://www.dexian.vip
 * License: http://www.dexian.vip/license
 */

package vip.dexian.admin.command;

import vip.dexian.core.base.command.BaseCommand;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.validator.constraints.Length;

import java.io.Serial;

/**
 * 部门保存
 *
 * @author 挺好的 2023年05月31日 9:54
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@EqualsAndHashCode (callSuper = true)
@SuperBuilder
public class DepartmentSaveCommand extends BaseCommand {

    @Serial
    private static final long serialVersionUID = -5785366759879060181L;

    /**
     * 名称
     */
    @NotBlank (message = "名称不能为空")
    @Length (min = 2, max = 20, message = "名称的长度应在{min}和{max}个字符之间")
    private String name;

    /**
     * 排序
     */
    @NotNull (message = "排序不能为空")
    @Min (value = 0, message = "排序值不可小于0")
    @Max (value = 999_999_999, message = "排序值不可大于999,999,999")
    private Integer order;

    /**
     * 是否启用
     */
    @NotNull (message = "是否启用不能为空")
    private Boolean isEnabled;

    /**
     * 上级部门ID
     */
    @Min (value = 0, message = "上级部门不可小于0")
    private Long parentId;
}
